package br.com.empeng.converter;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

import br.com.empeng.model.entidades.TransfBem;
import br.com.empeng.model.persistencia.dao.TransfBemDao;

@FacesConverter(value="TransfBemConverter")
public class TransfBemConverter implements Converter {
	
	TransfBemDao transfBemDao = new TransfBemDao();
	
	@Override
	public Object getAsObject(FacesContext arg0, UIComponent arg1, String idTela) {
		
		TransfBem transfBem= new TransfBem();
		transfBem.setId(Integer.parseInt(idTela));
		//Bem bem = cidadaDao.buscarPorId(Integer.parseInt(idTela));
		return  transfBem;
	}

	@Override
	public String getAsString(FacesContext arg0, UIComponent arg1, Object objtransfBem) {
		TransfBem transfBem = (TransfBem) objtransfBem;
		return  transfBem.getId().toString();	
	}
}
